<template>
  <!--<div id="superMapLayer-popup" class="new-ol-popup" style="display:none;">
    <div id="superMapLayer-popup-content"></div>
  </div>-->
  <div id="superMapLayer-mapDiv" class="ol-popup">
    <!--<div id="superMapLayer-popup" class="new-ol-popup" style="display:none;">
      <a href="#" id="superMapLayer-popup-closer" class="new-ol-popup-closer"></a>
      <div id="superMapLayer-popup-content">test</div>
    </div>-->
  </div>
</template>
<script>
import '@/assets/map/ol/ol.css';
import { getProjection,getResolutions,getTiandituVecMap,getTiandituVecText,getTiandituImgMap,getTiandituImgText,
  getRESTLayer,getVectorTileLayer,iServerHttp,meterToDegree,degreeToMeter } from "@/map/projMap.js";
import Map from 'ol/Map';
import View from 'ol/View';
import VectorLayer from 'ol/layer/Vector';
import {Vector as VectorSource} from 'ol/source'
import {Control} from 'ol/control';
import WKT from 'ol/format/WKT';
import GeoJSON from 'ol/format/GeoJSON';
import Overlay from 'ol/Overlay';
import Feature from 'ol/Feature';
import Point from 'ol/geom/Point';
import Polygon from 'ol/geom/Polygon';
import LineString from 'ol/geom/LineString';
import Circle from 'ol/geom/Circle';
import CircleDraw from 'ol/geom/Circle';
import {fromCircle} from 'ol/geom/Polygon';
import {Fill, Stroke, Style, Icon, Circle as CircleStyle,Text} from 'ol/style';
import {Select, Draw, Modify, Snap, Translate} from 'ol/interaction';
import {getArea, getLength} from 'ol/sphere';
import {unByKey} from 'ol/Observable';
import {boundingExtent} from 'ol/extent';
import dingweiImg from '@/assets/map/image/newImage/blueMarker.png';
import {
  GetGridCellInfosParameters,
  GridCellInfosService,
  MapService,
  GetFeaturesByGeometryParameters,FeatureService,
  Util
} from '@supermap/iclient-ol';
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'

export default {
  name: "SuperMapLayerMap",
  components: {

  },
  props:{
    map:{//地图对象
      type: Object,
      required:false,
      default: {}
    },
    pageType:{
      type: String,
      required:false,
      default: ""
    },
    mapDrawType: {//是否开启地图圈选查询
      type:String,
      required:false,
      default: ""
    },
    allRadioIndexData: {//全部序号列表
      type:Array,
      required:true,
      default:[]
    },
    allListData: {//全部查询结果列表
      type:Array,
      required:true,
      default:[]
    },
    allListDataArray: {//全部加载|移除图层信息列表
      type:Array,
      required:true,
      default:[]
    },
    typeCodeDataList: {//选择图层的版本号数据列表
      type:Array,
      required:true,
      default:[]
    },
    resetClearAllBool: {//是否重置清空全部图层数组
      type:Boolean,
      required:false,
      default:false
    },
    dataTypeInfoArray:{//图层数据类型数组
      type: Array,
      required:false,
      default: []
    },
    queryGeomText: {//限制查询范围的空间数据wkt
      type:String,
      required:false,
      default: ""
    },
    clickLonLatArr: {//获取点击地图经纬度
      type: Array,
      required:false,
      default: []
    },
  },
  emits:["getDetailDataById","getLegendHtml","getAllTempLayersSetList","getCompleteLayerReturn"],
  data() {
    return {
      str: "superMapLayer",
      mapStr:"bcIndexMap",
      center: [105, 34],
      zoom: 4,
      mapLoadingBool:false,//是否正在查询参数
      zoomDefaultPositionBool:true,//显示主界面
      switchMapBool:false,//切换地图
      layer1:null,//天地图街道图
      layer2:null,
      layer3:null,//天地图卫星图
      layer4:null,
      draw:null,//矢量绘制
      snap:null,
      select:null,
      modify:null,
      drag:null,
      source:null,//矢量绘制图层数据
      measureSource:null,//测量结果图层数据
      measure:null,//测量工具
      sketch:null,
      helpTooltipElement:null,
      helpTooltip:null,
      measureTooltipElement:null,
      measureTooltip:null,
      measureTooltipArray:[],//全部测量结果Overlay数组
      showHideMeasureTool:true,//显示|隐藏测量工具
      measureDistanceBool:true,
      measureAreaBool:true,
      stopMeasureBool:true,
      clearMeasureBool:true,
      showHidePositionTool:true,//显示|隐藏定位工具
      addPositionBool:true,
      clearPositionBool:true,
      popupInfoLayer:null,//弹出窗口
      showHideToolsBox:true,
      //addressMatchService:null,//地址匹配
      addressUrl:"https://iserver.supermap.io/iserver/services/addressmatch-Address/restjsr/v1/address",
      selectFeature:null,//选中要素
      allDataList:[],//全部查询结果数组
      allListDataList:[],//全部加载|移除图层信息列表
      typeCodeDataArray:[],//选择图层的版本号数据列表
      allRadioIndexList:[],//全部序号列表
      allBaseVectorLayerArray:[],//全部图层数组列表
      //超图图层服务使用数据
      selectLayerIndex:null,//选中图层的序号
      allRestVectorLayerArray:[],//全部超图图层数组
      showLayerNum:0,//当前显示的图层数量
      queryLayerNum:0,//已查询的图层数量
      resultDataTypeInfo:null,//已查询到图层要素结果的数据类型信息
      resultDataId:null,//已查询到的图层要素主键ID
      resultDataFeature:null,//已查询到的图层要素数据
      selectFeatureLayer:null,//选中要素高亮显示图层
      loading:null,//是否正在查询
      queryGeomWkt: "",//限制查询范围的空间数据wkt
      clickLonLat:[],//点击地图经纬度
      overlay:null,//地图弹窗
      token:null,//超图server口令
    }
  },
  watch: {
    map: {//地图对象
      handler: function(newVal,oldVal){
        if(newVal!=oldVal){
          console.log("地图对象");
          console.log(newVal);
          //初始化地图基础数据组件信息
          this.initMap();
        }
      },
      immediate:true
    },
    allRadioIndexData: {//全部序号列表
      handler: function(newVal,oldVal){
        if(newVal!=oldVal){
          this.allRadioIndexList = newVal;
          //根据全部序号列表设置全部查询图层数组
          this.addAllBaseVectorLayerArray();
          //根据全部序号列表设置全部超图图层数组
          this.addAllRestVectorLayerArray();
        }
      },
      immediate:true
    },
    allListData: {
      handler: function(newVal,oldVal){
        this.allDataList = newVal;
        if(newVal!=oldVal){
          this.showAllListData();
        }
      },
      immediate:true
    },
    allListDataArray: {//全部加载|移除图层信息列表
      handler: function(newVal,oldVal){
        this.allListDataList = newVal;
        if(newVal!=oldVal){
          this.showAllListDataList();
        }
      },
      immediate:true
    },
    typeCodeDataList: {//选择图层的版本号数据列表
      handler: function(newVal,oldVal){
        if(newVal!=oldVal){
          this.typeCodeDataArray = newVal;
          console.log("typeCodeDataList");
          console.log(newVal);
        }
      },
      immediate:true,deep:true
    },
    resetClearAllBool: {//是否重置清空全部图层数组
      handler: function(newVal,oldVal){
        if(newVal==true){
          //重置清空全部图层数组
          this.resetClearAllEvent();
          //重置清空全部超图图层数组
          this.resetClearAllRestLayerEvent();
        }
      },
      immediate:true
    },
    dataTypeInfoArray:{//图层数据类型数组
      handler: function(newVal,oldVal){
        if(newVal!=oldVal){

        }
      },
      immediate:true
    },
    queryGeomText: {//限制查询范围的空间数据wkt
      handler: function(newVal,oldVal){
        if(newVal!=oldVal){
          this.queryGeomWkt = newVal;
        }
      },
      immediate:true
    },
    clickLonLatArr: {//获取点击地图经纬度
      handler: function(newVal,oldVal){
        if(newVal!=oldVal){
          this.clickLonLat = newVal;
          console.log("传递点击地图经纬度");
          console.log(newVal);
          //根据经纬度查询当前显示的图层要素数据
          this.getAllShowLayerFeatureDataByLonLat(this.clickLonLat);
        }
      },
      immediate:true
    },
  },
  mounted() {
    console.log("mounted地图基础数据组件异步加载");
    let that = this;
    //地图基础数据组件异步加载
    this.$nextTick(function(){
      console.log('地图基础数据组件异步加载');
      //地图基础数据组件异步加载
      setTimeout(() => {
        //初始化地图基础数据组件信息
        that.initMap();
      }, 1000);
    });
  },
  methods: {
    initMap() {
      if(this.map!=null && this.map.getSize()!=null){
        if(this.initBool){//是否完成初始化工具条控件
          return;
        }
        //选中要素高亮显示图层
        this.selectFeatureLayer = new VectorLayer({
          source: new VectorSource({
            wrapX: false
          }),
          projection: 'EPSG:4490'
        });
        this.map.addLayer(this.selectFeatureLayer);
        this.selectFeatureLayer.setZIndex(50);
        //获取地图弹窗
        let temp = this.map.getOverlays();
        if(temp!=null && temp.array_.length>0){
          this.overlay = temp.array_[0];
        }

        //是否完成初始化工具条控件
        this.initBool = true;
      }
    },
    //全部加载|移除图层信息列表
    showAllListDataList(){
      let list = this.allListDataList;
      for(let i=0;i<list.length;i++){
        this.allDataList = list[i];
        //地图显示全部查询结果
        this.showAllListData();
      }
      //图例html
      this.$emit("getCompleteLayerReturn",{list:list});
    },
    //地图显示全部查询结果
    showAllListData(){
      let allDataList = this.allDataList;
      if(allDataList!=null && allDataList.length==5){
        console.log("地图显示全部查询结果");
        let typeCode = allDataList[0];//三级数据类别（数据表）code
        let versionCode = allDataList[1];
        let resultList = allDataList[2];
        let bool = allDataList[3];//添加、移除版本号图层
        let tifFileName = allDataList[4];//tif文件名称
        //根据图层序号和版本号设置图层数组并获取当前版本号图层
        let selectLayer = this.setBaseVectorLayer(typeCode,versionCode,bool);
        if(selectLayer!=null){
          if(resultList!=null && resultList.length>0){
            this.showDataList(typeCode,selectLayer,versionCode,resultList);//显示查询图层数据
          }else{
            //清空图层上的所有要素
            //selectLayer.getSource().clear();
          }
        }
        //超图图层
        //根据图层序号和版本号设置超图图层数组并获取当前版本号图层
        let selectRestLayer = this.setRestVectorLayer(typeCode,versionCode,bool,tifFileName);
        if(selectRestLayer!=null){
          let params = {
            typeCode:typeCode,//三级数据类别
            versionCode:versionCode,
            show:bool,
            sqlText:selectRestLayer.sqlText
            // sqlText:""
          }
          console.log("params");
          console.log(params);
          //根据查询图层信息参数查询并显示图层
          this.queryLayersByParams(params);
        }
      }
    },
    showDataList(typeCode,selectLayer,versionCode,list){//显示查询图层数据
      console.log("显示查询图层数据"+versionCode);
      if(selectLayer!=null){
        //selectLayer.getSource().clear();//清空
        if(list!=null && list.length>0){
          console.log("length"+list.length);
          //全部经纬度
          let allCoordinates = [];
          for(let i=0;i<list.length;i++){
            let id = this.getDataIdByType(typeCode,list[i]);//根据数据类型解析数据主键ID
            let geomText = list[i].geom;//空间数据wkt
            if(geomText!=null && geomText!=""){
              geomText = geomText.toUpperCase();//转换大写字母
              if(geomText.indexOf("POINT")!=-1 || geomText.indexOf("MULTIPOINT")!=-1 ||
                  geomText.indexOf("LINESTRING")!=-1 || geomText.indexOf("MULTILINESTRING")!=-1 ||
                  geomText.indexOf("POLYGON")!=-1 || geomText.indexOf("MULTIPOLYGON")!=-1) {//矢量数据
                //空间数据
                let featureTmp = new WKT().readFeature(geomText);
                if(geomText.indexOf("POINT")!=-1 || geomText.indexOf("MULTIPOINT")!=-1){//点
                  //样式
                  let style = this.getPointStyle();
                  featureTmp.setStyle(style);
                }else if(geomText.indexOf("LINESTRING")!=-1 || geomText.indexOf("MULTILINESTRING")!=-1){//线
                  //样式
                  let style = this.getLineStringStyle("blue");
                  featureTmp.setStyle(style);
                }else if(geomText.indexOf("POLYGON")!=-1 || geomText.indexOf("MULTIPOLYGON")!=-1){//面
                  //样式
                  let style = this.getPolyonStyle("blue");
                  featureTmp.setStyle(style);
                }
                //设置属性
                featureTmp.setProperties({
                  id:id,//主键ID
                  //versionCode:versionCode,//版本号
                  typeCode:typeCode,//三级数据类别（数据表）code
                });
                //添加矢量数据
                selectLayer.getSource().addFeature(featureTmp);
                //获取范围
                let extent = featureTmp.getGeometry().getExtent();
                if(extent.length==4){
                  //全部经纬度--左下角
                  allCoordinates.push([extent[0],extent[1]]);
                  //全部经纬度--右上角
                  allCoordinates.push([extent[2],extent[3]]);
                }
              }
            }
          }
          this.showBoundingExtent(allCoordinates);//缩放到区域位置
        }
      }
    },
    showBoundingExtent(coordinates){//缩放到区域位置
      //console.log("缩放到区域位置");
      if (coordinates!=null && coordinates.length > 1) {
        const extent = boundingExtent(coordinates);
        //this.map.getView().fit(extent, {duration: 1000, padding: [50, 50, 50, 50]});
        this.map.getView().fit(extent, {padding: [50, 50, 50, 50]});
        //获取默认位置
        this.center = this.map.getView().getCenter();
        this.zoom = this.map.getView().getZoom();
      }
    },
    //根据图层序号获取图层数组
    getSelectLayerArray(typeCode){
      let selectLayerArray = null;//选择图层
      if(this.allRadioIndexList!=null && this.allRadioIndexList.length>0){
        for(let i=0;i<this.allRadioIndexList.length;i++){
          if(this.allRadioIndexList[i]==typeCode){
            selectLayerArray = this.allBaseVectorLayerArray[i];
            break;
          }
        }
      }

      return selectLayerArray;
    },
    //根据版本号获取图层
    getSelectLayer(selectLayerArray,versionCode){
      let selectLayer = null;//选择图层
      if(selectLayerArray!=null && selectLayerArray.length>0){
        for(let i=0;i<selectLayerArray.length;i++){
          let temp = selectLayerArray[i].getProperties();
          if(temp.versionCode==versionCode){
            selectLayer = selectLayerArray[i];
            break;
          }
        }
      }

      return selectLayer;
    },
    //根据图层序号和版本号设置图层数组
    setBaseVectorLayer(typeCode,versionCode,bool){
      let selectLayer = null;
      //根据图层序号获取图层数组
      let selectLayerArray = this.getSelectLayerArray(typeCode);
      //根据版本号获取图层
      selectLayer = this.getSelectLayer(selectLayerArray,versionCode);
      if(bool){//添加图层
        if(selectLayer!=null){
          console.log("已有图层"+versionCode);
          return selectLayer;
        }
        console.log("创建图层"+versionCode);
        //创建图层
        selectLayer = new VectorLayer({
          source: new VectorSource({
            wrapX: false
          }),
          projection: 'EPSG:4490'
        });
        this.map.addLayer(selectLayer);
        selectLayer.setZIndex(4);
        selectLayer.setProperties({
          versionCode:versionCode,
        });
        //添加图层数组
        selectLayerArray.push(selectLayer);
      }else{//移除图层
        //根据版本号清除图层要素
        this.removeLayerDataByTypeCode(selectLayerArray,versionCode);
      }

      return selectLayer;
    },
    //根据版本号清除图层要素
    removeLayerDataByTypeCode(selectLayerArray,versionCode){
      debugger;
      console.log("根据版本号清除图层要素"+versionCode);
      console.log(selectLayerArray);
      //查找版本号图层
      let index = -1;
      if(selectLayerArray!=null && selectLayerArray.length>0){
        for(let i=0;i<selectLayerArray.length;i++){
          let temp = selectLayerArray[i].getProperties();
          if(temp.versionCode==versionCode){
            index = i;
            break;
          }
        }
      }
      console.log(index);
      if(index!=-1){
        //清空图层上的所有要素
        selectLayerArray[index].getSource().clear();
        //移除图层
        this.map.removeLayer(selectLayerArray[index]);
        //图层数组移除图层
        selectLayerArray.splice(index,1);
      }
    },
    //重置清空全部图层数组
    resetClearAllEvent(){
      console.log("重置清空全部图层数组");
      let list = this.allBaseVectorLayerArray;
      if(list!=null && list.length>0){
        for(let i=0;i<list.length;i++) {
          let selectLayerArray = this.allBaseVectorLayerArray[i];
          if(selectLayerArray!=null && selectLayerArray.length>0){
            for(let j=0;j<selectLayerArray.length;j++){
              //清空图层上的所有要素
              this.allBaseVectorLayerArray[i][j].getSource().clear();
              //移除图层
              this.map.removeLayer(this.allBaseVectorLayerArray[i][j]);
            }
          }
          //清空图层数组
          this.allBaseVectorLayerArray[i] = [];
        }
      }
    },
    //根据全部序号列表设置全部查询图层数组
    addAllBaseVectorLayerArray(){
      let allLayerArray = [];
      if(this.allRadioIndexList!=null && this.allRadioIndexList.length>0){
        for(let i=0;i<this.allRadioIndexList.length;i++){
          allLayerArray.push([]);
        }
      }
      this.allBaseVectorLayerArray = allLayerArray;
    },
    getDataIdByType(typeCode,data){//根据数据类型解析数据主键ID
      let id = "";
      if(typeCode=="sjxzq"){//省级行政区
        id = data.jbId;
      }else if(typeCode=="djxzq"){//地级行政区
        id = data.jbId;
      }else if(typeCode=="xjxzq"){//县级行政区
        id = data.jbId;
      }else if(typeCode=="xjxzq1"){//乡级行政区
        id = data.jbId;
      }else if(typeCode=="sjxzzx"){//省级行政中心
        id = data.jrpId;
      }else if(typeCode=="djxzzx"){//地级行政中心
        id = data.jrcId;
      }else if(typeCode=="xjxzzx"){//县级行政中心
        id = data.jrcId;
      }else if(typeCode=="xjxzzx1"){//乡级行政中心
        id = data.jrtId;
      }else if(typeCode=="xzcszd"){//行政村所在地
        id = data.jrvId;
      }else if(typeCode=="xjxzzx1"){//乡级行政中心
        id = data.jbId;
      }else if(typeCode=="yg1"){//遥感
        id = data.jrsId;
      }else if(typeCode=="dc"){//断层
        id = data.id;
      }else if(typeCode=="dcyx1"){//地层岩性
        id = data.id;
      }else if(typeCode=="wxxsjpgad"){//危险性数据PGA点
        id = data.id;
      }else if(typeCode=="wxxsjdjd"){//危险性数据等级点
        id = data.id;
      }else if(typeCode=="wxxsjdjm"){//危险性数据等级面
        id = data.id;
      }else if(typeCode=="ls434ysqzml"){//历史4 3/4以上强震目录
        id = data.jscId;
      }else if(typeCode=="1970nylxzml"){//1970年以来小震目录
        id = data.jicId;
      }else if(typeCode=="whqy1"){//危化企业
        id = data.jdeId;
      }else if(typeCode=="jyjqz1"){//加油（加气）站
        id = data.jgsId;
      }else if(typeCode=="wxhxpfswxy"){//危险化学品、放射危险源
        id = data.jdsId;
      }else if(typeCode=="csbncs"){//城市避难场所
        id = data.jesId;
      }else if(typeCode=="wzcbk"){//物资储备库
        id = data.jmrId;
      }else if(typeCode=="dzyjyab"){//地震应急预案表（非空间数据）
        id = data.jepId;
      }else if(typeCode=="jzwgwsj"){//建筑物格网数据
        id = data.jdgggthId;
      }else if(typeCode=="czzz"){//城镇住宅
        id = data.jrcchId;
      }else if(typeCode=="czfzz"){//城镇非住宅
        id = data.jrccnhId;
      }else if(typeCode=="nczzdlzz"){//农村住宅（独立住宅）
        id = data.jrccdhId;
      }else if(typeCode=="nczzjhzz"){//农村住宅（集合住宅）
        id = data.jrccjhId;
      }else if(typeCode=="fzyf"){//辅助用房
        id = data.jrccfhId;
      }else if(typeCode=="ncfzz"){//农村非住宅
        id = data.jrccnhId;
      }else if(typeCode=="dl1"){//道路
        id = data.jlId;
      }else if(typeCode=="ql1"){//桥梁
        id = data.jlbId;
      }else if(typeCode=="jc1"){//机场
        id = data.jaId;
      }else if(typeCode=="xxb"){//学校表
        id = data.jsId;
      }else if(typeCode=="yy1"){//医院
        id = data.jhId;
      }else if(typeCode=="rktjb"){//人口统计表
        id = data.jpId;
      }else if(typeCode=="rkglwgsj"){//人口公里网格数据
        id = data.id;
      }

      return id;
    },
    /////////////////////////////////////////////////////////////////////////////////////////超图图层服务start
    //REST图层查询
    createMapRestLayer(iIndex,jIndex,layerUrl,layerID,zIndex){//根据layerUrl、临时图层layerID和zIndex查询并添加瓦片地图图层REST
      let that = this;
      console.log(iIndex+","+jIndex);
      //瓦片地图图层
      let mapService = new MapService(layerUrl);//根据超图REST图层获取图层信息
      mapService.getMapInfo(function (serviceResult) {
        if(serviceResult.result!=undefined){
          let mapJSONObj = serviceResult.result;
          console.log("mapJSONObj--"+layerUrl);
          console.log(mapJSONObj);
          //获取超图发布的REST图层
          //let options = TileSuperMapRest.optionsFromMapJSON(layerUrl, mapJSONObj);
          let layerName = mapJSONObj.name;//图层名称
          //获取图层范围
          let bounds = mapJSONObj.bounds;
          let left = bounds.left;
          let bottom = bounds.bottom;
          let right = bounds.right;
          let top = bounds.top;
          let origin = [left, top];//左上角
          let extent = [left, bottom, right, top];//图层范围
          //获取超图发布的REST图层（自定义比例尺）
          let layer = getRESTLayer(layerUrl,layerID,origin,extent,mapJSONObj,17);
          if(that.allRestVectorLayerArray[iIndex][jIndex].queryGeomBool && that.queryGeomWkt){//限制查询范围的空间数据wkt
            //空间数据
            let featureTmp = new WKT().readFeature(that.queryGeomWkt);
            //添加图层掩膜
            Util.setMask(layer,featureTmp);
          }
          that.map.addLayer(layer);
          //设置图层叠加顺序
          layer.setZIndex(zIndex);
          //添加到REST图层数组
          that.allRestVectorLayerArray[iIndex][jIndex].restTileLayer = layer;
          if(layerID && layerID!==""){
            //设置临时图层ID
            that.allRestVectorLayerArray[iIndex][jIndex].tempLayerId = layerID;
          }
          //图层范围
          that.allRestVectorLayerArray[iIndex][jIndex].extent = extent;
          console.log("extent");
          console.log(extent);
          if(that.allRestVectorLayerArray[iIndex][jIndex].fitBool){//是否缩放到范围
            //缩放到图层范围
            that.map.getView().fit(extent, {padding: [50, 50, 50, 50]});
          }
          //图层范围
          let bbox = extent.join(",");
          //图层显示名称
          let realName = that.allRestVectorLayerArray[iIndex][jIndex].name;
          //获取图例
          that.getLayerLegend(realName,layerUrl,bbox);//根据url获取图层图例信息
          //获取全部图层信息列表
          that.getAllTempLayersSetList();
        }
      });
    },
    //临时图层SQL查询更新并获取瓦片图层REST
    deleteRestMapTempLayersSet(layerUrl,layerID){//删除超图临时图层
      let that = this;
      let url = encodeURI(layerUrl + "/tempLayersSet.rjson");
      //查询
      let httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
      httpRequest.open('GET', url, true);//第二步：打开连接  将请求参数写在url中  ps:"http://localhost:8080/rest/xxx"
      httpRequest.send();//第三步：发送请求  将请求参数写在URL中
      //获取数据后的处理程序
      httpRequest.onreadystatechange = function () {
        if (httpRequest.readyState == 4 && httpRequest.status == 200) {
          let json = httpRequest.responseText;//获取到json字符串，还需解析
          let obj = JSON.parse(json);
          if(obj.length>0){
            for(let i=0;i<obj.length;i++){
              let path = obj[i].path;
              if(layerID!=null && layerID!=""){//指定临时图层ID
                if(obj[i].name==layerID){
                  that.deleteTempLayersSet(path);//删除超图临时图层
                  break;
                }
              }else{//全部临时图层
                that.deleteTempLayersSet(path);//删除超图临时图层
              }
            }
          }
        }
      };
    },
    deleteTempLayersSet(url){//删除超图临时图层
      url = encodeURI(url);
      let xhr = new XMLHttpRequest();//第一步：建立所需的对象
      xhr.open("DELETE", url, true);//第二步：打开连接  将请求参数写在url中
      xhr.send();//第三步：发送请求  将请求参数写在URL中
      // 获取数据后的处理程序
      xhr.onreadystatechange = function(){
        let readyState = xhr.readyState;
        if (readyState == 4){
          let status = xhr.status;
          let responseText =  xhr.responseText ;
          let result = JSON.parse(responseText);
          if(result.succeed){
            //that.$message({ message: '删除临时图层成功!', type: 'success' });
          }else{
            //that.$message({ message: '删除临时图层失败!', type: 'warning' });
          }
          xhr.onreadystatechange = function(){};
          xhr = null;
        }
      };
    },
    createRestMapTempLayersSet(iIndex,jIndex,layerUrl,zIndex,sqlText){//查询REST图层信息并创建新的临时图层
      let url = encodeURI(layerUrl +"/layers.rjson");
      let that = this;
      //查询REST图层信息
      let httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
      httpRequest.open('GET', url, true);//第二步：打开连接  将请求参数写在url中
      httpRequest.send();//第三步：发送请求  将请求参数写在URL中
      //获取数据后的处理程序
      httpRequest.onreadystatechange = function () {
        if (httpRequest.readyState == 4 && httpRequest.status == 200) {
          let json = httpRequest.responseText;//获取到json字符串，还需解析
          let obj = JSON.parse(json);
          if(obj.length>0){
            if(sqlText!=null && sqlText!=""){
              for(let i=0;i<obj.length;i++){
                let layers = obj[i].subLayers.layers;
                for(let j=0;j<layers.length;j++){
                  layers[j].displayFilter = sqlText;//SQL查询过滤
                }
              }
            }
            that.postTempLayersSet(iIndex,jIndex,layerUrl,zIndex,obj);//创建并获取超图临时图层
          }
        }
      };
    },
    postTempLayersSet(iIndex,jIndex,layerUrl,zIndex,obj){//创建并获取超图临时图层
      let that = this;
      let url = encodeURI(layerUrl+"/tempLayersSet.rjson");
      let entry = JSON.stringify(obj);
      let xhr = new XMLHttpRequest();//第一步：建立所需的对象
      xhr.open("POST", url, true);//第二步：打开连接  将请求参数写在url中
      xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
      //获取数据后的处理程序
      xhr.onreadystatechange = function(){
        let readyState = xhr.readyState;
        if (readyState == 4){
          let status = xhr.status;
          let responseText =  xhr.responseText ;
          let result = JSON.parse(responseText);
          if(result.succeed){
            let layerID = result.newResourceID;
            let newResourceLocation = result.newResourceLocation;
            //that.$message({ message: '创建临时图层成功!', type: 'success' });
            //查询超图临时图层
            //that.getMapTempLayer(iIndex,jIndex,layerUrl,layerID,zIndex);
            //根据layerUrl、临时图层layerID和zIndex查询并添加瓦片地图图层REST
            that.createMapRestLayer(iIndex,jIndex,layerUrl,layerID,zIndex);
          }else{
            //that.$message({ message: '创建临时图层失败!', type: 'warning' });
          }
          xhr.onreadystatechange = function(){};
          xhr = null;
        }
      };
      xhr.send(entry);//第三步：发送请求  将请求参数写在URL中
    },
    getMapTempLayer(iIndex,jIndex,layerUrl,layerID,zIndex){//查询超图临时图层
      let that = this;
      let url = encodeURI(layerUrl + "/tempLayersSet.rjson");
      //查询
      let httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
      httpRequest.open('GET', url, true);//第二步：打开连接  将请求参数写在url中  ps:"http://localhost:8080/rest/xxx"
      httpRequest.send();//第三步：发送请求  将请求参数写在URL中
      //获取数据后的处理程序
      httpRequest.onreadystatechange = function () {
        if (httpRequest.readyState == 4 && httpRequest.status == 200) {
          let json = httpRequest.responseText;//获取到json字符串，还需解析
          let obj = JSON.parse(json);
          if(obj.length>0){
            if(layerID!=null && layerID!=""){
              for(let i=0;i<obj.length;i++){
                if(obj[i].name==layerID){
                  //根据layerUrl、临时图层layerID和zIndex查询并添加瓦片地图图层REST
                  that.createMapRestLayer(iIndex,jIndex,layerUrl,layerID,zIndex);
                  break;
                }
              }
            }else{
              layerID  = obj[0].name;//默认取第一个
              //根据layerUrl、临时图层layerID和zIndex查询并添加瓦片地图图层REST
              that.createMapRestLayer(iIndex,jIndex,layerUrl,layerID,zIndex);
            }
            that.$message({ message: '查询成功!', type: 'success' });
          }else{
            that.$message({ message: '无查询结果!', type: 'warning' });
          }
        }
      };
    },
    queryTempLayersSetBySql(iIndex,jIndex,layerUrl,zIndex,sqlText) {//根据SQL条件筛选更新并查询超图临时图层信息
      let that = this;
      let url = encodeURI(layerUrl + "/tempLayersSet.rjson");
      //查询
      let httpRequest = new XMLHttpRequest();
      httpRequest.open('GET', url, true);
      httpRequest.send();
      //获取数据后的处理程序
      httpRequest.onreadystatechange = function () {
        if (httpRequest.readyState == 4 && httpRequest.status == 200) {
          let json = httpRequest.responseText;//获取到json字符串，还需解析
          let obj = JSON.parse(json);
          if(obj.length>0){
            //let tempUrl = obj[0].path;
            let layerID  = obj[0].name;//默认选第一个临时图层
            //更新超图临时图层信息
            that.getPutTempLayersSet(iIndex,jIndex,layerUrl,layerID,zIndex,sqlText);
          }
        }
      };
    },
    getPutTempLayersSet(iIndex,jIndex,layerUrl,layerID,zIndex,sqlText){//更新超图临时图层信息
      let that = this;
      //查询
      let url = encodeURI(layerUrl+"/tempLayersSet/"+layerID+".rjson");
      //查询
      let httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
      httpRequest.open('GET', url, true);//第二步：打开连接  将请求参数写在url中  ps:"http://localhost:8080/rest/xxx"
      httpRequest.send();//第三步：发送请求  将请求参数写在URL中
      //获取数据后的处理程序
      httpRequest.onreadystatechange = function () {
        if (httpRequest.readyState == 4 && httpRequest.status == 200) {
          let json = httpRequest.responseText;//获取到json字符串，还需解析
          let obj = JSON.parse(json);
          if(obj.length>0){
            for(let i=0;i<obj.length;i++){
              let layers = obj[i].subLayers.layers;
              for(let j=0;j<layers.length;j++){
                layers[j].displayFilter = sqlText;//SQL查询过滤
              }
            }
          }
          //更新超图临时图层信息
          that.putTempLayersSet(iIndex,jIndex,url,layerUrl,layerID,zIndex,obj);
        }
      };
    },
    putTempLayersSet(iIndex,jIndex,url,layerUrl,layerID,zIndex,obj){//更新超图临时图层信息，获取临时图层
      let that = this;
      let entry = JSON.stringify(obj);
      let xhr = new XMLHttpRequest();//第一步：建立所需的对象
      xhr.open("PUT", url, true);//第二步：打开连接  将请求参数写在url中
      xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
      //获取数据后的处理程序
      xhr.onreadystatechange = function(){
        let readyState = xhr.readyState;
        if (readyState == 4){
          let status = xhr.status;
          let responseText =  xhr.responseText ;
          let result = JSON.parse(responseText);
          if(result.succeed){
            //that.$message({ message: '更新临时图层成功!', type: 'success' });
            //查询超图临时图层
            //that.getMapTempLayer(iIndex,jIndex,layerUrl,layerID,zIndex);
            //根据layerUrl、临时图层layerID和zIndex查询并添加瓦片地图图层REST
            that.createMapRestLayer(iIndex,jIndex,layerUrl,layerID,zIndex);
          }else{
            //that.$message({ message: '更新临时图层失败!', type: 'warning' });
          }
          xhr.onreadystatechange = function(){};
          xhr = null;
        }
      };
      xhr.send(entry);//第三步：发送请求  将请求参数写在URL中
    },
    //获取数据类型信息
    getDataTypeInfo(value,type){
      let dataTypeInfo = null;
      if(value && type && this.dataTypeInfoArray!=null && this.dataTypeInfoArray.length>0){
        for(let i=0;i<this.dataTypeInfoArray.length;i++){
          if(this.dataTypeInfoArray[i][type]===value){
            dataTypeInfo = this.dataTypeInfoArray[i];
            break;
          }
        }
      }

      return dataTypeInfo;
    },
    addAllRestVectorLayerArray(){//全部超图图层数组
      let allLayerArray = [];
      if(this.allRadioIndexList!=null && this.allRadioIndexList.length>0){
        for(let i=0;i<this.allRadioIndexList.length;i++){
          allLayerArray.push([]);
        }
      }
      this.allRestVectorLayerArray = allLayerArray;
    },
    //根据图层序号获取超图图层数组
    getRestSelectLayerArray(typeCode){
      let selectRestLayerArray = null;//选择图层
      if(this.allRadioIndexList!=null && this.allRadioIndexList.length>0){
        for(let i=0;i<this.allRadioIndexList.length;i++){
          if(this.allRadioIndexList[i]==typeCode){
            selectRestLayerArray = this.allRestVectorLayerArray[i];
            break;
          }
        }
      }

      return selectRestLayerArray;
    },
    //根据版本号获取超图图层
    getRestSelectLayer(selectRestLayerArray,versionCode){
      let selectRestLayer = null;//选择图层
      if(versionCode && selectRestLayerArray!=null && selectRestLayerArray.length>0){
        for(let i=0;i<selectRestLayerArray.length;i++){
          let temp = selectRestLayerArray[i];
          if(temp.versionCode==versionCode){
            selectRestLayer = selectRestLayerArray[i];
            break;
          }
        }
      }

      return selectRestLayer;
    },
    //根据图层序号获取图层数组序号
    getRestLayerIndex(typeCode){
      let index = null;
      if(typeCode && this.allRestVectorLayerArray!=null && this.allRestVectorLayerArray.length>0) {
        for(let i=0;i<this.allRestVectorLayerArray.length;i++){
          if(this.allRadioIndexList[i]==typeCode){
            index = i;
            break;
          }
        }
      }

      return index;
    },
    //根据图层序号和版本号获取图层序号
    getRestVectorLayerIndexArray(typeCode,versionCode){
      let indexArray = [];
      if(typeCode && versionCode && this.allRestVectorLayerArray!=null && this.allRestVectorLayerArray.length>0) {
        for(let i=0;i<this.allRestVectorLayerArray.length;i++){
          if(this.allRadioIndexList[i]==typeCode){
            for(let j=0;j<this.allRestVectorLayerArray[i].length;j++){
              if(this.allRestVectorLayerArray[i][j].versionCode==versionCode){
                indexArray = [i,j];
              }
            }
            break;
          }
        }
      }

      return indexArray;
    },
    //根据图层序号和版本号设置超图图层数组
    setRestVectorLayer(typeCode,versionCode,bool,tifFileName){
      let selectLayer = null;
      //根据图层序号获取图层数组序号
      let iIndex = this.getRestLayerIndex(typeCode);
      //根据图层序号和版本号获取图层序号
      let indexArray = this.getRestVectorLayerIndexArray(typeCode,versionCode);
      let jIndex = null;
      if(indexArray!=null && indexArray.length==2){
        iIndex = indexArray[0];
        jIndex = indexArray[1];
        selectLayer = this.allRestVectorLayerArray[iIndex][jIndex];
      }
      console.log("iIndex"+iIndex+",jIndex"+jIndex);
      if(bool){//添加超图图层
        if(selectLayer!=null){
          console.log("已有超图图层"+versionCode);
          return selectLayer;
        }
        console.log("创建超图图层"+versionCode);
        //创建超图图层
        if(typeCode && this.typeCodeDataArray!=null && this.typeCodeDataArray.length>0){
          for(let i=0;i<this.typeCodeDataArray.length;i++){
            if(this.typeCodeDataArray[i].dictItemCode==typeCode){
              let code = this.typeCodeDataArray[i].dictItemCode;
              let name = this.typeCodeDataArray[i].name;
              let fitBool = this.typeCodeDataArray[i].fitBool;
              let queryGeomBool = this.typeCodeDataArray[i].queryGeomBool;
              let sqlText = versionCode;//查询临时图层
              if(versionCode=="全部"){//查询全部
                sqlText = "";
              }else{
                /*if(queryGeomBool && this.queryGeomWkt){//限制查询范围的空间数据wkt
                  //获取数据类型信息
                  let dataTypeInfo = this.getDataTypeInfo(code,"code");
                  let tableName = dataTypeInfo.table;
                  if(tableName){
                    sqlText += " and ST_Intersects("+tableName+".geom,st_geomfromtext('"+this.queryGeomWkt+"',4490))";
                  }
                }*/
              }
              selectLayer = {
                typeCode:code,//图层类型code（三级数据类别）
                name:name,//图层名称
                vectorTileLayer:null,//REST矢量切片图层
                restTileLayer:null,//REST瓦片图层
                sqlText:sqlText,//查询条件
                tempLayerId:null,//临时图层ID
                vectorTileStyles:null,//矢量切片样式
                versionCode:versionCode,//版本号
                fitBool:fitBool,//是否缩放到范围
                queryGeomBool:queryGeomBool,//是否限制查询范围
                tifFileName:tifFileName,//tif发布文件名称
                url:null,//超图图层URL
                extent:[],//图层范围
              };
              break;
            }
          }
        }
        //添加超图图层数组
        this.allRestVectorLayerArray[iIndex].push(selectLayer);
        console.log("this.allRestVectorLayerArray--add");
        console.log(this.allRestVectorLayerArray);
      }else{//移除超图图层
        //根据版本号清除超图图层要素
        this.removeRestLayerDataByTypeCode(iIndex,jIndex);
      }

      return selectLayer;
    },
    //根据版本号清除超图图层要素
    removeRestLayerDataByTypeCode(iIndex,jIndex){
      if(iIndex!=null && jIndex!=null){
        //图层名称
        let realName = this.allRestVectorLayerArray[iIndex][jIndex].name;
        //移除图层
        if(this.allRestVectorLayerArray[iIndex][jIndex].vectorTileLayer!=null){//REST矢量切片图层
          //移除图层
          this.map.removeLayer(this.allRestVectorLayerArray[iIndex][jIndex].vectorTileLayer);
          this.allRestVectorLayerArray[iIndex][jIndex].vectorTileLayer = null;
          this.allRestVectorLayerArray[iIndex][jIndex].vectorTileStyles = null;
        }
        if(this.allRestVectorLayerArray[iIndex][jIndex].restTileLayer!=null){//REST瓦片图层
          //移除图层
          this.map.removeLayer(this.allRestVectorLayerArray[iIndex][jIndex].restTileLayer);
          this.allRestVectorLayerArray[iIndex][jIndex].restTileLayer = null;
        }
        //图层数组移除图层
        this.allRestVectorLayerArray[iIndex].splice(jIndex,1);
        //判断是否此数据类型的版本号超图图层数组为空
        if(this.allRestVectorLayerArray[iIndex].length==0){
          //清空图例
          this.$emit("getLegendHtml",{name:realName,legendHtml:"",show:false});
        }
        console.log("this.allRestVectorLayerArray--remove");
        console.log(this.allRestVectorLayerArray);
      }
    },
    //重置清空全部超图图层数组
    resetClearAllRestLayerEvent(){
      console.log("重置清空全部超图图层数组");
      let list = this.allRestVectorLayerArray;
      if(list!=null && list.length>0){
        for(let i=0;i<list.length;i++) {
          let selectLayerArray = this.allRestVectorLayerArray[i];
          if(selectLayerArray!=null && selectLayerArray.length>0){
            for(let j=0;j<selectLayerArray.length;j++){
              if(this.allRestVectorLayerArray[i][j]){
                if (this.allRestVectorLayerArray[i][j].vectorTileLayer != null) {//REST矢量切片图层
                  //移除图层
                  this.map.removeLayer(this.allRestVectorLayerArray[i][j].vectorTileLayer);
                  this.allRestVectorLayerArray[i][j].vectorTileLayer = null;
                  this.allRestVectorLayerArray[i][j].vectorTileStyles = null;
                }
                if(this.allRestVectorLayerArray[i][j].restTileLayer!=null){//REST瓦片图层
                  //移除图层
                  this.map.removeLayer(this.allRestVectorLayerArray[i][j].restTileLayer);
                  this.allRestVectorLayerArray[i][j].restTileLayer = null;
                }
              }
            }
          }
          //清空图层数组
          this.allRestVectorLayerArray[i] = [];
        }
      }
    },
    //根据查询图层信息参数查询并显示图层
    queryLayersByParams(params){
      debugger;
      if(params.typeCode && params.typeCode!=="" && params.versionCode && params.versionCode!==""){
        //清空全部选择图层要素
        this.clearAllSelectionLayer();
        for(let i=0;i<this.allRestVectorLayerArray.length;i++){
          for(let j=0;j<this.allRestVectorLayerArray[i].length;j++){
            if(this.allRestVectorLayerArray[i][j] && this.allRestVectorLayerArray[i][j].typeCode===params.typeCode && this.allRestVectorLayerArray[i][j].versionCode===params.versionCode){
              if(this.allRestVectorLayerArray[i][j].vectorTileLayer!=null){//REST矢量切片图层
                //移除图层
                this.map.removeLayer(this.allRestVectorLayerArray[i][j].vectorTileLayer);
                this.allRestVectorLayerArray[i][j].vectorTileLayer = null;
                this.allRestVectorLayerArray[i][j].vectorTileStyles = null;
              }
              if(this.allRestVectorLayerArray[i][j].restTileLayer!=null){//REST瓦片图层
                //移除图层
                this.map.removeLayer(this.allRestVectorLayerArray[i][j].restTileLayer);
                this.allRestVectorLayerArray[i][j].restTileLayer = null;
              }
              //地图服务
              //获取数据类型信息
              let dataTypeInfo = this.getDataTypeInfo(params.typeCode,"code");
              let url = dataTypeInfo.url;
              console.log(url);
              //test
              //url = "http://10.13.155.192:8090/iserver/services/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";

              if(params.show) {//显示图层
                let zIndex = dataTypeInfo.zIndex;
                let sqlText = params.sqlText;
                console.log(sqlText);
                let code = dataTypeInfo.code;
                if(code=="demgcsj" || code=="dxdmpd" || code=="dxdmpx"){//tif图层
                  sqlText = "";
                  let tifFileName = this.allRestVectorLayerArray[i][j].tifFileName;
                  console.log(tifFileName);
                  /*//test
                  if(code=="demgcsj"){
                    tifFileName = "坐标转换后的四川dem90米_202305100949_1683683386203";
                  }else if(code=="dxdmpd"){
                    tifFileName = "坡度_1683855831608";
                  }else if(code=="dxdmpx"){
                    tifFileName = "坡向_1683855872669";
                  }*/
                  url = url + tifFileName;//tif图层url
                  console.log(url);
                }
                this.allRestVectorLayerArray[i][j].url = url;//超图图层URL
                if(sqlText && sqlText!==""){//根据sql条件显示临时图层
                  let layerID = this.allRestVectorLayerArray[i][j].tempLayerId;//临时图层ID
                  if(layerID!=null && layerID!=="") {//指定临时图层ID
                    //更新超图临时图层信息
                    this.getPutTempLayersSet(i,j,url,layerID,zIndex,sqlText);
                  }else{
                    console.log("createRestMapTempLayersSet");
                    this.createRestMapTempLayersSet(i,j,url,zIndex,sqlText);//查询REST图层信息并创建新的临时图层
                  }
                  //根据url和zIndex、sqlText添加矢量切片图层
                  // this.createVectorTileLayer(i,j,url,zIndex,sqlText);
                  /*if(code=="ls434ysqzml"){//历史4 3/4以上强震目录
                    //根据url和zIndex、sqlText添加矢量切片图层
                    this.createVectorTileLayer(i,j,url,zIndex,sqlText);
                  }*/
                }else{//显示整个图层
                  // this.deleteRestMapTempLayersSet(url,null);//删除超图临时图层
                  // url = "http://10.13.155.192:8090/iserver/services/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
                  //根据url、临时图层layerID和zIndex添加瓦片地图图层REST
                  this.createMapRestLayer(i,j,url,'',zIndex);
                  //根据url和zIndex添加矢量切片图层
                  // this.createVectorTileLayer(i,j,url,zIndex,null);
                  /*if(code=="ls434ysqzml"){//历史4 3/4以上强震目录
                    //根据url和zIndex添加矢量切片图层
                    this.createVectorTileLayer(i,j,url,zIndex,null);
                  }*/
                }
              }else{//隐藏图层
                //
              }
              break;
            }
          }
        }
      }
    },
    getLayerLegend(realName,layerUrl,bbox){//根据url获取图层图例信息
      let that = this;
      layerUrl += '/legend.json?bbox='+bbox;
      layerUrl += '&returnVisibleOnly=false';//是否只返回当前地图范围内可见要素的图例。默认为 false
      //图层图例信息查询
      let httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
      httpRequest.open('GET', layerUrl, true);//第二步：打开连接  将请求参数写在url中  ps:"http://localhost:8080/rest/xxx"
      httpRequest.send();//第三步：发送请求  将请求参数写在URL中
      /**
       * 获取数据后的处理程序
       */
      httpRequest.onreadystatechange = function () {
        if (httpRequest.readyState == 4 && httpRequest.status == 200) {
          let json = httpRequest.responseText;//获取到json字符串，还需解析
          let obj = JSON.parse(json);
          let layerLegends = obj.layerLegends;
          if(layerLegends!=null && layerLegends.length>0){
            let html = '';
            for(let i=0;i<layerLegends.length;i++){
              let layerLegend = layerLegends[i];
              //获取图层名称
              let layerName = layerLegend.layerName;
              let legends = layerLegend.legends;
              if(legends!=null && legends.length>0){
                if(layerName.indexOf("#")!=-1 && legends.length==1){
                  let textImgUrl = iServerHttp() + "/iserver/manager/static/Theme/image/LabelUniform.png";
                  //文字图层不显示图例
                  if(legends[0].url==textImgUrl){
                    continue;
                  }
                }
                if(legends.length>1){//多图例图层
                  layerName = realName;
                  html += '<p style="text-align: center;font-weight: bold;">'+layerName+'</p>';
                  for(let j=0;j<legends.length;j++){
                    let legend = legends[j];
                    let values = legend.values;
                    if(values==null){
                      continue;
                    }
                    let imageData = legend.imageData;
                    let contentType = legend.contentType;
                    let url = legend.url;
                    let label = legend.label;
                    let width = legend.width;
                    let height = legend.height;
                    let imgSrc = "data:image/jpeg;base64,"+imageData;
                    html += '<p style="height: '+height+'px;">';
                    html += '<img style="width:'+width+'px;height:'+height+'px" src="'+imgSrc+'" />';
                    html += '<span style="position: relative;top: -2px;left: 10px;height: 16px;font-size: 16px;">'+label+'</span>';
                    html += '</p>';
                  }
                  if(realName=="历史4 3/4以上强震目录"){
                    html = '<p style="text-align: center;font-weight: bold;">'+layerName+'</p>';
                    for(let j=0;j<legends.length;j++){
                      let legend = legends[j];
                      let values = legend.values;
                      if(values==null){
                        continue;
                      }
                      let imageData = legend.imageData;
                      let contentType = legend.contentType;
                      let url = legend.url;
                      let label = legend.label;
                      let width = legend.width;
                      let height = legend.height;
                      width = 10 + 3 * j;
                      height = 10 + 3 * j;
                      if(j==4){
                        width = 24;
                        height = 24;
                      }
                      let imgSrc = "data:image/jpeg;base64,"+imageData;
                      html += '<p>';
                      html += '<img style="width:'+width+'px;height:'+height+'px" src="'+imgSrc+'" />';
                      html += '<span style="position: relative;top: -2px;left: 10px;height: 16px;font-size: 16px;">'+label+'</span>';
                      html += '</p>';
                    }
                  }
                }else{//单一图例图层
                  //多图例标题
                  if(realName=="单指标风险区划--抗震能力-确定评估风险区划1"){
                    html += '<p style="text-align: center;font-weight: bold;">抗震能力-单指标确定评估风险区划</p>';
                  }else if(realName=="单指标风险区划--人员伤亡-确定评估风险区划1"){
                    html += '<p style="text-align: center;font-weight: bold;">人员伤亡-单指标确定评估风险区划</p>';
                  }else if(realName=="单指标风险区划--人员伤亡-确定评估风险区划6--新疆、青海和西藏地区确定评估风险区划1"){
                    html += '<p style="text-align: center;font-weight: bold;">人员伤亡-新疆、青海和西藏地区</p>';
                  }else if(realName=="单指标风险区划--经济损失-确定评估风险区划1"){
                    html += '<p style="text-align: center;font-weight: bold;">经济损失-单指标确定评估风险区划</p>';
                  }else if(realName=="单指标风险区划--经济损失-确定评估风险区划6--新疆、青海和西藏地区确定评估风险区划1"){
                    html += '<p style="text-align: center;font-weight: bold;">经济损失-新疆、青海和西藏地区</p>';
                  }/*else if(realName=="单指标风险区划--概率评估风险区划1"){
                    html += '<p style="text-align: center;font-weight: bold;">单指标概率评估风险区划</p>';
                  }else if(realName=="单指标风险区划--概率评估风险区划6--新疆、青海和西藏地区确定评估风险区划1"){
                    html += '<p style="text-align: center;font-weight: bold;">新疆、青海和西藏地区</p>';
                  }*/

                  let legend = legends[0];
                  let values = legend.values;
                  let imageData = legend.imageData;
                  let contentType = legend.contentType;
                  let url = legend.url;
                  let label = legend.label;
                  let width = legend.width;
                  let height = legend.height;
                  let imgSrc = "data:image/jpeg;base64,"+imageData;
                  html += '<p style="height: '+height+'px;">';
                  html += '<img style="width:'+width+'px;height:'+height+'px" src="'+imgSrc+'" />';
                  html += '<span style="position: relative;top: -2px;left: 10px;height: 16px;font-size: 16px;">'+realName+'</span>';
                  html += '</p>';
                }
              }
            }
            //图例html
            that.$emit("getLegendHtml",{name:realName,legendHtml:html,show:true});
          }
        }
      };
    },
    //根据url和zIndex、sqlText添加矢量切片图层
    createVectorTileLayer(iIndex,jIndex,layerUrl,zIndex,sqlText) {
      let that = this;
      //layerUrl = "http://10.13.155.192:8090/iserver/services/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
      //瓦片地图图层
      let mapService = new MapService(layerUrl);//根据超图矢量瓦片图层获取图层信息
      mapService.getMapInfo(function (serviceResult) {
        if(serviceResult.result!=undefined){
          let mapJSONObj = serviceResult.result;
          //获取超图发布的REST图层
          //let options = TileSuperMapRest.optionsFromMapJSON(newUrl, mapJSONObj);
          let layerName = mapJSONObj.name;//图层名称
          //获取图层范围
          let bounds = mapJSONObj.bounds;
          let left = bounds.left;
          let bottom = bounds.bottom;
          let right = bounds.right;
          let top = bounds.top;
          let origin = [left, top];//左上角
          let extent = [left, bottom, right, top];//图层范围
          //获取超图发布的REST矢量切片图层（自定义比例尺）
          let resultArr = getVectorTileLayer(that.map,layerUrl,origin,extent,that.map.getView(),mapJSONObj,sqlText,0);
          let layer = resultArr[0];
          that.allRestVectorLayerArray[iIndex][jIndex].vectorTileStyles = resultArr[1];//矢量切片样式
          //自定义样式
          // that.allRestVectorLayerArray[iIndex][jIndex].vectorTileStyles.setCustomStyleFuntion(null);
          that.map.addLayer(layer);
          zIndex = zIndex - 1;//test
          //设置图层叠加顺序
          layer.setZIndex(zIndex);
          //添加到REST图层数组
          that.allRestVectorLayerArray[iIndex][jIndex].vectorTileLayer = layer;
          // console.log("extent");
          // console.log(extent);
          //缩放到图层范围
          that.map.getView().fit(extent, {padding: [50, 50, 50, 50]});
          //图层范围
          let bbox = extent.join(",");
          //图层显示名称
          let realName = that.allRestVectorLayerArray[iIndex][jIndex].name;
          //获取图例
          that.getLayerLegend(realName,layerUrl,bbox);//根据url获取图层图例信息
        }
      });
    },
    //清空全部选择图层要素
    clearAllSelectionLayer(){
      if(this.selectLayerIndex && this.selectLayerIndex.length==2){
        let iIndex = this.selectLayerIndex[0];
        let jIndex = this.selectLayerIndex[1];
        if(iIndex && jIndex && this.allRestVectorLayerArray[iIndex][jIndex].vectorTileLayer){
          //矢量切片样式
          if(this.allRestVectorLayerArray[iIndex][jIndex].vectorTileStyles){
            this.allRestVectorLayerArray[iIndex][jIndex].vectorTileStyles.featureSelectedFunction({
              selectedId: null,
              layerName: null,
              fieldId:null
            });
            if(this.allRestVectorLayerArray[iIndex][jIndex].vectorTileLayer){
              this.allRestVectorLayerArray[iIndex][jIndex].vectorTileLayer.changed();
            }
          }
        }
      }
    },
    //获取全部图层信息列表
    getAllTempLayersSetList(){
      let list = [];
      let minLon = null;
      let minLat = null;
      let maxLon = null;
      let maxLat = null;
      for(let i=0;i<this.allRestVectorLayerArray.length;i++){
        for(let j=0;j<this.allRestVectorLayerArray[i].length;j++){
          let url = this.allRestVectorLayerArray[i][j].url;//图层url
          let tempLayerId = this.allRestVectorLayerArray[i][j].tempLayerId;//临时图层ID
          let name = this.allRestVectorLayerArray[i][j].name;//图层名称
          let typeCode = this.allRestVectorLayerArray[i][j].typeCode;//图层类型code（三级数据类别）
          if(tempLayerId){//临时图层
            url += "/tempLayersSet/"+tempLayerId;
          }
          let obj = {
            typeCode:typeCode,
            name:name,
            url:url
          }
          list.push(obj);
          //图层范围
          let extent = this.allRestVectorLayerArray[i][j].extent;
          if(extent && extent.length==4){
            if(minLon==null){
              minLon = extent[0];
              minLat = extent[1];
              maxLon = extent[2];
              maxLat = extent[3];
            }else{//获取最大范围
              if(minLon>extent[0]){
                minLon = extent[0];
              }
              if(minLat>extent[1]){
                minLat = extent[1];
              }
              if(maxLon<extent[2]){
                maxLon = extent[2];
              }
              if(maxLat<extent[3]){
                maxLat = extent[3];
              }
            }
          }
        }
      }
      let geomText = "";//空间范围
      if(minLon!=null){
        geomText = "MULTIPOLYGON((("+minLon+" "+minLat+","+maxLon+" "+minLat+","+maxLon+" "+maxLat+","+minLon+" "+maxLat+","+minLon+" "+minLat+")))";
      }
      //图例html
      this.$emit("getAllTempLayersSetList",{list:list,geomText:geomText});
    },
    /////////////////////////////////////////////////////////////////////////////////////////超图图层服务end
    /////////////////////////////////////////////////////////////////////////////////////经纬度查询图层数据start
    //根据经纬度查询当前显示的图层要素数据
    getAllShowLayerFeatureDataByLonLat(lonlat){
      console.log("根据经纬度查询当前显示的图层要素数据--allRestVectorLayerArray");
      console.log(this.allRestVectorLayerArray);
      if(this.overlay!=null && lonlat!=null && lonlat.length==2){
        this.overlay.setPosition(undefined);//隐藏弹窗
        this.showLayerNum = 0;//当前显示的图层数量
        this.queryLayerNum = 0;//已查询的图层数量
        this.resultDataTypeInfo = null;//已查询到图层要素结果的数据类型信息
        this.resultDataId = null;//已查询到的图层要素主键ID
        this.resultDataFeature = null;//已查询到的图层要素数据
        //清空选中要素高亮显示图层
        this.selectFeatureLayer.getSource().clear();
        //获取当前显示的图层数量
        for(let i=0;i<this.allRestVectorLayerArray.length;i++) {
          if (this.allRestVectorLayerArray[i].length > 0) {
            this.showLayerNum = this.showLayerNum + this.allRestVectorLayerArray[i].length;
          }
        }
        if(this.showLayerNum>0){
          //正在查询
          this.loading = ElLoading.service({
            lock: true,
            text: '正在查询...',
            background: 'rgba(0, 0, 0, 0.7)',
          });
          for(let i=0;i<this.allRestVectorLayerArray.length;i++){
            if(this.allRestVectorLayerArray[i].length>0){
              for(let j=0;j<this.allRestVectorLayerArray[i].length;j++) {
                let typeCode = this.allRestVectorLayerArray[i][j].typeCode;//图层类型code
                let versionCode = this.allRestVectorLayerArray[i][j].versionCode;//版本数据
                if(versionCode){
                  console.log(typeCode+",versionCode--"+versionCode);
                  if (typeCode == "demgcsj" || typeCode == "dxdmpd" || typeCode == "dxdmpx") {
                    // //获取数据类型信息
                    // let dataTypeInfo = this.getDataTypeInfo(code,"code");
                    let datasetName = this.allRestVectorLayerArray[i][j].name;
                    /*//test
                    if(typeCode=="demgcsj"){
                      datasetName = "坐标转换后的四川dem90米_202305100949_1683683386203";
                    }else if(typeCode=="dxdmpd"){
                      datasetName = "坡度_1683855831608";
                    }else if(typeCode=="dxdmpx"){
                      datasetName = "坡向_1683855872669";
                    }*/
                    console.log(datasetName+","+typeCode);
                    //获取数据类型信息
                    let dataTypeInfo = this.getDataTypeInfo(typeCode,"code");
                    //根据表名和经纬度查询图层要素数据
                    this.getTifValueInfo(lonlat, datasetName,dataTypeInfo);
                  } else{
                    //获取数据类型信息
                    let dataTypeInfo = this.getDataTypeInfo(typeCode,"code");
                    //查询过滤条件
                    /*let sql = "del_flag='0'";
                    if(versionCode && versionCode!="全部"){//水系无版本号查询全部
                      sql = "del_flag='0' and data_version like '%"+versionCode+"%'";//查询临时图层
                    }*/
                    let sql = this.allRestVectorLayerArray[i][j].sqlText;
                    if(sql=="全部"){
                      sql = "";
                    }
                    //经纬度查询图层数据
                    this.queryFeatureByLonLat(dataTypeInfo.database,dataTypeInfo.table,lonlat,dataTypeInfo,sql);
                  }
                }
              }
            }
          }
        }
      }else{
        if(this.overlay!=null) {
          this.overlay.setPosition(undefined);//隐藏弹窗
        }
      }
    },
    getTifValueInfo(lonlat,datasetName,dataTypeInfo){//根据经纬度获取栅格值
      if(lonlat!=null &&　lonlat.length==2){
        let that = this;
        let tifUrl = iServerHttp()+"/iserver/services/data-demtif/rest/data";
        let getGridCellInfosParam = new GetGridCellInfosParameters({
          dataSourceName: "demtif",
          datasetName: datasetName,
          X: lonlat[0],
          Y: lonlat[1]
        });
        new GridCellInfosService(tifUrl).getGridCellInfos(getGridCellInfosParam, function (serviceResult) {
          console.log(serviceResult);
          that.queryLayerNum = that.queryLayerNum + 1;//已查询的图层数量
          console.log(that.showLayerNum+"--"+that.queryLayerNum);
          if (!serviceResult.result) {
            if(that.queryLayerNum==that.showLayerNum) {//查询完毕
              that.overlay.setPosition(undefined);
              //根据类型显示弹窗
              that.setPopupContentByType(lonlat);
              //查询完毕
              that.loading.close();
            }
            return;
          }
          let result = serviceResult.result;
          console.log(result);
          //主键ID
          let id = null;
          if(that.resultDataTypeInfo){//已查询到图层要素结果的数据类型信息
            if(that.resultDataTypeInfo.zIndex < dataTypeInfo.zIndex){//图层顺序大的优先查询
              that.resultDataTypeInfo = dataTypeInfo;
              that.resultDataId = id;
              that.resultDataFeature = result;
            }
          }else{
            that.resultDataTypeInfo = dataTypeInfo;
            that.resultDataId = id;
            that.resultDataFeature = result;
          }
          if(that.queryLayerNum==that.showLayerNum) {//查询完毕
            // let innerHTML = "行: " + result.row + "<br>";
            // innerHTML += "列: " + result.column + "<br>";
            // innerHTML += "值: " + result.value + "<br>";
            // that.setPopupContent(innerHTML);
            // that.overlay.setPosition(lonlat);
            //根据类型显示弹窗
            that.setPopupContentByType(lonlat);
            //查询完毕
            that.loading.close();
          }
        });
      }
    },
    setPopupContent(html){//设置弹窗内容
      document.getElementById(this.mapStr+'-popup-content').innerHTML = html;
      //显示弹出窗口
      document.getElementById(this.mapStr+"-popup").style.display="block";
    },
    queryFeatureByLonLat(databaseName,tableName,lonlat,dataTypeInfo,sql){//经纬度查询图层数据
      console.log("sql----"+sql);
      if(databaseName && tableName && lonlat!=null && lonlat.length==2 && dataTypeInfo){
        let datasource = databaseName;
        let dataset = tableName;
        // let geomText = "POINT("+lonlat[0]+" "+lonlat[1]+")";
        // //空间数据
        // let feature = new WKT().readFeature(geomText);
        let zoom = this.map.getView().getZoom();
        let temp = Math.pow(2,(18 - zoom));
        //点生成圆多边形
        // let meter = 3 * temp;//米
        let meter = 10 * temp;//米
        let degree = meterToDegree(meter);
        let circle = new Circle(lonlat, degree); // 用圆心和半径确定一个圆
        let polygon = new fromCircle(circle) // 得到一个多边形
        let feature = new Feature({
          geometry: polygon
        });
        //添加矢量数据
        // this.selectFeatureLayer.getSource().addFeature(feature);//选中要素高亮显示图层
        this.queryFeatureByGeometry(datasource,dataset,feature,dataTypeInfo,lonlat,sql);//几何查询
      }
    },
    queryFeatureByGeometry(datasource,dataset,feature,dataTypeInfo,lonlat,sql){//几何查询
      let that = this;
      //let url = "http://10.13.155.192:8090/iserver/services/data-fxfzdzzh/rest/data";
      let url = iServerHttp() + "/iserver/services/data-"+datasource+"/rest/data";
      let polygon = feature.getGeometry();
      let geometryParam = new GetFeaturesByGeometryParameters({
        datasetNames: [datasource+":"+dataset],
        geometry: polygon,
        spatialQueryMode: "INTERSECT",
        attributeFilter:sql,//查询过滤条件
      });
      new FeatureService(url).getFeaturesByGeometry(geometryParam, function (serviceResult) {
        console.log("dataset"+dataset);
        console.log(serviceResult.result);
        if(serviceResult.result){
          let features = serviceResult.result.features.features;
          if(features && features.length>0){
            console.log(features);
            console.log(features[0].properties);
            let fieldId = dataTypeInfo.fieldId.toUpperCase();//主键ID字段名
            //主键ID
            let id = features[0].properties[fieldId];
            if(that.resultDataTypeInfo){//已查询到图层要素结果的数据类型信息
              if(that.resultDataTypeInfo.zIndex < dataTypeInfo.zIndex){//图层顺序大的优先查询
                that.resultDataTypeInfo = dataTypeInfo;
                that.resultDataId = id;
                that.resultDataFeature = features[0];
              }
            }else{
              that.resultDataTypeInfo = dataTypeInfo;
              that.resultDataId = id;
              that.resultDataFeature = features[0];
            }
          }
        }
        /*let vectorSource = new VectorLayer({
          features: (new GeoJSON()).readFeatures(serviceResult.result.features),
          wrapX: false
        });
        let resultLayer = new VectorSource({
          source: vectorSource,
        });
        that.map.addLayer(resultLayer);*/
        that.queryLayerNum = that.queryLayerNum + 1;//已查询的图层数量
        console.log("queryLayerNum:"+that.queryLayerNum+"--"+that.showLayerNum);
        if(that.queryLayerNum==that.showLayerNum){//查询完毕
          if(that.resultDataTypeInfo && that.resultDataId){
            // let temp = {
            //   id:that.resultDataId,
            //   typeCode:that.resultDataTypeInfo.code
            // }
            // console.log(temp);
            //空间数据
            // let featureTmp = new GeoJSON().readFeature(that.resultDataFeature.geometry);
            /*if(geomText.indexOf("POINT")!=-1 || geomText.indexOf("MULTIPOINT")!=-1){//点
              //样式
              let style = this.getPointStyle();
              featureTmp.setStyle(style);
            }else if(geomText.indexOf("LINESTRING")!=-1 || geomText.indexOf("MULTILINESTRING")!=-1){//线
              //样式
              let style = this.getLineStringStyle("blue");
              featureTmp.setStyle(style);
            }else if(geomText.indexOf("POLYGON")!=-1 || geomText.indexOf("MULTIPOLYGON")!=-1){//面
              //样式
              let style = this.getPolyonStyle("blue");
              featureTmp.setStyle(style);
            }*/
            //添加矢量数据
            // that.selectFeatureLayer.getSource().addFeature(featureTmp);//选中要素高亮显示图层
            //查询数据详情
            // that.$emit("getDetailDataById",temp);
          }
          //根据类型显示弹窗
          that.setPopupContentByType(lonlat);
          //查询完毕
          that.loading.close();
        }
      });
    },
    setPopupContentByType(lonlat){//根据类型显示弹窗
      console.log("根据类型显示点击要素属性弹窗");
      let dataTypeInfo = this.resultDataTypeInfo;
      console.log(dataTypeInfo);
      if(dataTypeInfo){//有查询要素数据
        let database = dataTypeInfo.database;
        let type = "矢量数据";
        if(database=="demtif"){
          type = "栅格数据";
        }
        console.log(type);
        if(type=="矢量数据"){
          let typeCode = dataTypeInfo.code;
          let id = this.resultDataId;//主键ID
          let features = this.resultDataFeature;
          let properties = features.properties;
          console.log(dataTypeInfo);
          console.log(id);
          console.log(features);
          console.log(properties);
          let temp = {
            id:id,
            typeCode:dataTypeInfo.code,
            database:dataTypeInfo.database,
          }
          //查询数据详情
          // this.$emit("getDetailDataById",temp);
          //获取显示内容
          let innerHTML = this.getPopupContent(dataTypeInfo,properties);
          console.log("innerHTML----"+innerHTML);
          //显示地图弹窗
          this.setPopupContent(innerHTML);
          this.overlay.setPosition(lonlat);
        }else if(type=="栅格数据"){
          let result = this.resultDataFeature;//栅格信息
          let innerHTML = "行: " + result.row + "<br>";
          innerHTML += "列: " + result.column + "<br>";
          innerHTML += "值: " + result.value + "<br>";
          //显示地图弹窗
          this.setPopupContent(innerHTML);
          this.overlay.setPosition(lonlat);
          // //清空查询结果表
          // let temp = {
          //   id:null,
          //   typeCode:null,
          //   database:null,
          // }
          // //查询数据详情
          // this.$emit("getDetailDataById",temp);
        }
      }else{//清空查询结果表
        let temp = {
          id:null,
          typeCode:null,
          database:null,
        }
        //查询数据详情
        this.$emit("getDetailDataById",temp);
        this.overlay.setPosition(undefined);
      }
    },
    //获取要素属性详情html
    getPopupContent(dataTypeInfo,properties){
      let html = "";
      if(dataTypeInfo && properties){
        let datasource = dataTypeInfo.database;
        let dataset = dataTypeInfo.table;
        let columns = null;
        if(dataset=="jc_fault") {//断层
          columns = [
            {fieldName:"fracture_zone_name",name:"断裂带名称"},
            {fieldName:"dc_name",name:"断层名称"},
            {fieldName:"fault_segment_name",name:"断层段名称"},
            {fieldName:"strike_drection",name:"走向[16方位]"},
            {fieldName:"strike",name:"断层走向[度]"},
            {fieldName:"direction",name:"倾向[16方位]"},
            {fieldName:"clination",name:"倾角[度]"},
            {fieldName:"jf_length",name:"长度"},
          ];
          //设置字段名大写
          for(let i=0;i<columns.length;i++){
            columns[i].fieldName = columns[i].fieldName.toUpperCase();//转换大写字母
          }
        }else if(dataset=="jc_strong_catalog"){//历史地震
          columns = [
            {fieldName:"event_abbrevia",name:"地震事件名称"},
            {fieldName:"occurrence_date",name:"地震日期"},
            {fieldName:"longitude",name:"经度"},
            {fieldName:"latitude",name:"纬度"},
            {fieldName:"magnitude",name:"震级"},
            {fieldName:"depth",name:"震源深度"},
          ];
          //设置字段名大写
          for(let i=0;i<columns.length;i++){
            columns[i].fieldName = columns[i].fieldName.toUpperCase();//转换大写字母
          }
        }else if(dataset=="jc_emergcy_shelter"){//城市避难场所点数据
          columns = [
            {fieldName:"bncsmc",name:"避难场所名称"},
            {fieldName:"location",name:"具体地址"},
            {fieldName:"jes_longitude",name:"经度"},
            {fieldName:"jes_latitude",name:"纬度"},
            {fieldName:"type",name:"类型"},
            {fieldName:"area",name:"面积（m2）"},
            {fieldName:"popref",name:"容纳人数"},
          ];
          //设置字段名大写
          for(let i=0;i<columns.length;i++){
            columns[i].fieldName = columns[i].fieldName.toUpperCase();//转换大写字母
          }
        }else if(dataset=="cpxx_fxqh_reinforce_priority"){//房屋加固优先级
          html += "图层类型：房屋加固优先级<br>";
          columns = [
            {fieldName:"PRIORITY",name:"优先级"},
            {fieldName:"PROJECT_NAME",name:"名称"},
            {fieldName:"PROJECT_TYPE",name:"类型"},
            {fieldName:"UNIT",name:"单位"},
            {fieldName:"PROVINCE",name:"省"},
            {fieldName:"CITY",name:"市"},
            {fieldName:"AREA",name:"县"},
            {fieldName:"DETAILED_ADDRESS",name:"详细地址"},
            {fieldName:"LONGITUDE",name:"经度"},
            {fieldName:"LATITUDE",name:"纬度"},
            {fieldName:"EVALUATION_RESULT",name:"评估结果"},
          ];
        }else if(dataset=="cpxx_yh_disaster_fw" || dataset=="cpxx_yh_disaster_sz"){//重点隐患房屋住宅、重点隐患市政桥梁
          let addressStr = "详细地址";
          if(dataset=="cpxx_yh_disaster_fw") {//重点隐患房屋住宅
            html += "图层类型：重点隐患房屋住宅<br>";
            addressStr = "详细地址";
          }else if(dataset=="cpxx_yh_disaster_sz") {//重点隐患市政桥梁
            html += "图层类型：重点隐患市政桥梁<br>";
            addressStr = "详细地址行政编码";
          }
          columns = [
            {fieldName:"YH_UNIT",name:"单位"},
            {fieldName:"PROVINCE",name:"省"},
            {fieldName:"CITY",name:"市"},
            {fieldName:"AREA",name:"区（县）"},
            {fieldName:"DETAILED_ADDRESS",name:addressStr},
            {fieldName:"LATITUDE",name:"纬度 "},
            {fieldName:"LONGITUDE",name:"经度"},
            {fieldName:"EVALUATION_RESULT",name:"评估结果"},
            {fieldName:"EXTENDS2",name:"房屋类型 "},
            {fieldName:"IS_UP_TO_STANDARD",name:"抗震设防标准是否达标"},
            {fieldName:"OTHER_EARTHINTENSITY",name:"原结构抗震设防烈度 "},
            {fieldName:"PHEQ",name:"地震灾害隐患指数 "},
            {fieldName:"CVALUE",name:"承灾体破坏后果影响系数"},
            {fieldName:"RVALUE",name:"场址影响系数 "},
            {fieldName:"VVALUE",name:"承灾体易损性影响系数"},
            {fieldName:"YH_BUILDING_TIME",name:"建造年代"},
            {fieldName:"YH_CONSTRUCTION_SCALE",name:"建设规模"},
            {fieldName:"YH_EARTH_FORTIFICATION",name:"抗震设防类别 "},
            {fieldName:"YH_EARTH_INTENSITY",name:"现行抗震设防烈度"},
            {fieldName:"YH_EXISTING_VIRUS",name:"现存灾害"},
            {fieldName:"YH_FIELD_TYPE",name:"场地类别"},
            {fieldName:"YH_NOW_EARTH_QH",name:"现抗震设防区划"},
            {fieldName:"YH_PROJECT_TYPE",name:"工程类别"},
          ];
        }else if(dataset=="cpxx_fxqh_hdc100"){//活断层避让分布图（100米）
          html += "图层类型：活断层避让分布图（100米）<br>";
          columns = [
            {fieldName:"HDC_NAME",name:"断层名称"},
            {fieldName:"PROVINCE",name:"省"},
            {fieldName:"CITY",name:"市"},
            {fieldName:"AREA",name:"县"},
            {fieldName:"EXTENDS4",name:"详细信息"}
          ];
        }else if(dataset=="cpxx_fxqh_hdc200"){//活断层避让分布图（200米）
          html += "图层类型：活断层避让分布图（200米）<br>";
          columns = [
            {fieldName:"HDC_NAME",name:"断层名称"},
            {fieldName:"PROVINCE",name:"省"},
            {fieldName:"CITY",name:"市"},
            {fieldName:"AREA",name:"县"},
            {fieldName:"EXTENDS4",name:"详细信息"}
          ];
        }else if(dataset=="fxqh_assess_ed_qh_result"){//全国地震灾害风险区划图
          html += "图层类型：全国地震灾害风险区划图<br>";
          columns = [
            {fieldName:"PROVINCE",name:"省"},
            {fieldName:"CITY",name:"市"},
            {fieldName:"COUNTY",name:"县"},
            {fieldName:"CALCULATED_VALUE",name:"计算值"},
            {fieldName:"ESTIMATE_OBJ",name:"评估对象"},
            {fieldName:"CONDITION",name:"烈度"},
            {fieldName:"HOUSE_DATA_FLAG",name:"房屋数据类型"},
            {fieldName:"QH_LEVEL",name:"区划等级"},
          ];
        }
        if(columns){
          for(let i=0;i<columns.length;i++){
            let fieldName = columns[i].fieldName;
            let name = columns[i].name;
            let value = properties[fieldName];
            if(dataset=="cpxx_yh_disaster_fw" || dataset=="cpxx_yh_disaster_sz") {//重点隐患房屋住宅、重点隐患市政桥梁
              if(fieldName=="IS_UP_TO_STANDARD"){//抗震设防标准是否达标
                value = value=="1" ? "是" : "否"
              }
            }else if(dataset=="fxqh_assess_ed_qh_result") {//全国地震灾害风险区划图
              if(fieldName=="ESTIMATE_OBJ"){//评估对象
                if(value=="0"){
                  value = "抗震能力";
                }else if(value=="1"){
                  value = "人员伤亡";
                }else if(value=="2"){
                  value = "经济损失";
                }
                html = html.replace("图层类型：全国地震灾害风险区划图","图层类型：全国地震灾害风险区划图（"+value+"）");
              }else if(fieldName=="CONDITION"){//烈度
                if(value=="ld1"){
                  value = "6度";
                }else if(value=="ld2"){
                  value = "7度";
                }else if(value=="ld3"){
                  value = "8度";
                }else if(value=="ld4"){
                  value = "9度";
                }else if(value=="ld5"){
                  value = "10度";
                }
              }else if(fieldName=="HOUSE_DATA_FLAG"){//房屋数据类型
                if(value=="0"){
                  value = "房屋单体数据";
                }else if(value=="1"){
                  value = "房屋网格数据";
                }
              }
            }
            html += name + "：" + value + "<br>";
          }
        }
      }

      return html;
    },
    /////////////////////////////////////////////////////////////////////////////////////经纬度查询图层数据end
  }
}

</script>

<style scoped lang="scss">

</style>